{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import keras\n",
    "from math import sqrt\n",
    "import pandas as pd\n",
    "from pandas import read_csv\n",
    "from sklearn.metrics import mean_squared_error\n",
    "from sklearn.preprocessing import MinMaxScaler\n",
    "import matplotlib.pyplot as plt\n",
    "from keras.models import Sequential\n",
    "from keras.layers import Dense\n",
    "from keras.layers import Flatten\n",
    "from keras.layers import LSTM\n",
    "from keras.layers import RepeatVector\n",
    "from keras.layers import TimeDistributed\n",
    "\n",
    "from battdeg import  pl_samples_file_reader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dict_keys([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17])\n"
     ]
    }
   ],
   "source": [
    "data_dir = '/home/chintan/uwdirect/chintan/BattDeg/data/PL 12,14/'\n",
    "file_name_format = 'PL12(3).csv'\n",
    "ignore_file_indices = [1, 2, 3]\n",
    "df_pl12 = pl_samples_file_reader(data_dir, file_name_format, ignore_file_indices)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Time_sec</th>\n",
       "      <th>Date_Time</th>\n",
       "      <th>Step</th>\n",
       "      <th>Cycle</th>\n",
       "      <th>Current_Amp</th>\n",
       "      <th>Voltage_Volt</th>\n",
       "      <th>Charge_Ah</th>\n",
       "      <th>Discharge_Ah</th>\n",
       "      <th>charge_cycle_ah</th>\n",
       "      <th>discharge_cycle_ah</th>\n",
       "      <th>capacity_ah</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10.000357</td>\n",
       "      <td>735819.421979</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190699</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>20.000433</td>\n",
       "      <td>735819.422095</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190699</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>30.016045</td>\n",
       "      <td>735819.422211</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190861</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>40.031507</td>\n",
       "      <td>735819.422326</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190537</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>50.047247</td>\n",
       "      <td>735819.422454</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190861</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Time_sec      Date_Time Step Cycle  Current_Amp  Voltage_Volt  Charge_Ah  \\\n",
       "0  10.000357  735819.421979    1     1          0.0      4.190699        0.0   \n",
       "1  20.000433  735819.422095    1     1          0.0      4.190699        0.0   \n",
       "2  30.016045  735819.422211    1     1          0.0      4.190861        0.0   \n",
       "3  40.031507  735819.422326    1     1          0.0      4.190537        0.0   \n",
       "4  50.047247  735819.422454    1     1          0.0      4.190861        0.0   \n",
       "\n",
       "   Discharge_Ah  charge_cycle_ah  discharge_cycle_ah  capacity_ah  \n",
       "0           0.0              0.0                 0.0          0.0  \n",
       "1           0.0              0.0                 0.0          0.0  \n",
       "2           0.0              0.0                 0.0          0.0  \n",
       "3           0.0              0.0                 0.0          0.0  \n",
       "4           0.0              0.0                 0.0          0.0  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_pl12.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Converting to an array and only keeping the columns of interest\n",
    "df_pl12_arr = df_pl12[['Time_sec', 'Current_Amp', 'Voltage_Volt', 'capacity_ah']].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 296,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Time_sec</th>\n",
       "      <th>Date_Time</th>\n",
       "      <th>Step</th>\n",
       "      <th>Cycle</th>\n",
       "      <th>Current_Amp</th>\n",
       "      <th>Voltage_Volt</th>\n",
       "      <th>Charge_Ah</th>\n",
       "      <th>Discharge_Ah</th>\n",
       "      <th>charge_cycle_ah</th>\n",
       "      <th>discharge_cycle_ah</th>\n",
       "      <th>capacity_ah</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10.000357</td>\n",
       "      <td>735819.421979</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190699</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>20.000433</td>\n",
       "      <td>735819.422095</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190699</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>30.016045</td>\n",
       "      <td>735819.422211</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190861</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>40.031507</td>\n",
       "      <td>735819.422326</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190537</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>50.047247</td>\n",
       "      <td>735819.422454</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190861</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Time_sec      Date_Time Step Cycle  Current_Amp  Voltage_Volt  Charge_Ah  \\\n",
       "0  10.000357  735819.421979    1     1          0.0      4.190699        0.0   \n",
       "1  20.000433  735819.422095    1     1          0.0      4.190699        0.0   \n",
       "2  30.016045  735819.422211    1     1          0.0      4.190861        0.0   \n",
       "3  40.031507  735819.422326    1     1          0.0      4.190537        0.0   \n",
       "4  50.047247  735819.422454    1     1          0.0      4.190861        0.0   \n",
       "\n",
       "   Discharge_Ah  charge_cycle_ah  discharge_cycle_ah  capacity_ah  \n",
       "0           0.0              0.0                 0.0          0.0  \n",
       "1           0.0              0.0                 0.0          0.0  \n",
       "2           0.0              0.0                 0.0          0.0  \n",
       "3           0.0              0.0                 0.0          0.0  \n",
       "4           0.0              0.0                 0.0          0.0  "
      ]
     },
     "execution_count": 296,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_pl12.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 297,
   "metadata": {},
   "outputs": [],
   "source": [
    "fl = df_pl12.filter(regex='Current|Voltage|discharge_cycle_ah')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 298,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Current_Amp</th>\n",
       "      <th>Voltage_Volt</th>\n",
       "      <th>discharge_cycle_ah</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190699</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190699</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190861</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190537</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.0</td>\n",
       "      <td>4.190861</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Current_Amp  Voltage_Volt  discharge_cycle_ah\n",
       "0          0.0      4.190699                 0.0\n",
       "1          0.0      4.190699                 0.0\n",
       "2          0.0      4.190861                 0.0\n",
       "3          0.0      4.190537                 0.0\n",
       "4          0.0      4.190861                 0.0"
      ]
     },
     "execution_count": 298,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fl.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1.00003573e+01, 0.00000000e+00, 4.19069910e+00, 0.00000000e+00],\n",
       "       [2.00004326e+01, 0.00000000e+00, 4.19069910e+00, 0.00000000e+00],\n",
       "       [3.00160448e+01, 0.00000000e+00, 4.19086123e+00, 0.00000000e+00],\n",
       "       [4.00315073e+01, 0.00000000e+00, 4.19053745e+00, 0.00000000e+00],\n",
       "       [5.00472467e+01, 0.00000000e+00, 4.19086123e+00, 0.00000000e+00],\n",
       "       [6.00002065e+01, 0.00000000e+00, 4.19086123e+00, 0.00000000e+00],\n",
       "       [6.00005393e+01, 7.49501705e-01, 4.24766350e+00, 4.06994000e-10],\n",
       "       [7.00008408e+01, 7.54581988e-02, 4.19911432e+00, 2.29201240e-04],\n",
       "       [8.00008615e+01, 6.60183206e-02, 4.19911432e+00, 4.24199745e-04],\n",
       "       [9.00163072e+01, 6.02091625e-02, 4.19911432e+00, 5.99097648e-04]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_pl12_arr[0:10, :]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1784289, 4)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_pl12_arr.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f4d341cf710>]"
      ]
     },
     "execution_count": 167,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAD8CAYAAABjAo9vAAAABHNCSVQICAg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QmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(df_pl12_arr[:,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f4dab97c828>]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEDCAYAAADOc0QpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xd8FHX+x/HXhxB6J/QWOtLBUAXFdiL2CojeqSgKAbue/Cx46j3sp8cdFu5OvdOEKip2z66HhZBCDx0SWggl1EDK9/dHlrslJtkNbLK7yfv5eOTB7Ox3Zz6ZbN5MPjOzY845RESkYqkS7AJERCTwFO4iIhWQwl1EpAJSuIuIVEAKdxGRCkjhLiJSAQU13M3sdTPLMLPlfox90cySPV9rzGxfedQoIhKOLJjnuZvZmcBB4F/OuZ6leN0UoJ9z7uYyK05EJIwFdc/dOfcdsMd7npl1NLNPzWyJmX1vZt2KeOlYYFa5FCkiEoaqBruAIswEbnfOrTWzQcDLwDnHnzSzdkB74Ksg1SciEvJCKtzNrA4wFJhnZsdnVy80bAww3zmXV561iYiEk5AKdwraRPucc31LGDMGiC2nekREwlJInQrpnNsPbDSzawCsQJ/jz5tZV6Ah8GOQShQRCQvBPhVyFgVB3dXM0s1sPDAOGG9mKcAK4DKvl4wFZjt9lKWISImCeiqkiIiUDZ977v5caGRmIzwXF60ws28DW6KIiJSWzz13XxcamVkDYBEw0jm3xcyaOucyfK04KirKRUdHn1zV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qrQ3U9ZpeRMHZBc9x4gGcZz3TF3HiAZxfPPMbARspOHjT0DPdyPPcYs/Y4weJRnnmF7kOH/XOBm4KxW3Kr/vDQduGxa2jhFpHAiuBJoXGNeF/Bw07UHCmSkBr8vF9F64zaD/v4tZR3Db12q7fhtI29SvDyiIYy/KLgiPLayj4n/KhMlzPMAr+BFqK1ylbwFsUnOa0FFhY6I36kKeuVDxHyEuq2fOm+IWCU6DmAdU982t4Hq/zPN/BR60dPG/YFApO23zIM78x8CUFp1F96fXmM2CGp55lQIzXsm72rHcdJwZwDLDc85q/8r/Tu4pcRwm11gJ2A/W95oXENqXgz+7tQA4Fe03jg7kNfayjqFrXUdCjPeH0POAqz/siBUgELimjmn71fRdTZ1B/3iWs41e1eua/Cdxe6L0StG3q75c+fkBEpAIKt567iIj4QeEuIlIBKdxFRCoghbuISAWkcBcRqYAU7iIiFZDCXUSkAvp/HZEBEk7b81QAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(df_pl12_arr[:,0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 168,
   "metadata": {},
   "outputs": [],
   "source": [
    "# ensure all data is float\n",
    "values = df_pl12_arr.astype('float32')\n",
    "# # normalize features\n",
    "# scaler = MinMaxScaler(feature_range=(0, 1))\n",
    "# scaled = scaler.fit_transform(values)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1784289, 4)"
      ]
     },
     "execution_count": 169,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "values.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_pl12_arr_sample = values[0:10000, :]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Code inspired from Jason Brownlee's posrt here: \n",
    "# https://machinelearningmastery.com/how-to-develop-lstm-models-for-multi-step-time-series-forecasting-of-household-power-consumption/\n",
    "\n",
    "# multivariate multi-step encoder-decoder lstm\n",
    "# split a univariate dataset into train/test sets\n",
    "def split_dataset(data):\n",
    "\t# split into standard weeks\n",
    "\ttrain, test = data[1:-328], data[-328:-6]\n",
    "\t# restructure into windows of weekly data\n",
    "\ttrain = array(split(train, len(train)/7))\n",
    "\ttest = array(split(test, len(test)/7))\n",
    "\treturn train, test\n",
    "\n",
    "# evaluate one or more weekly forecasts against expected values\n",
    "def evaluate_forecasts(actual, predicted):\n",
    "\tscores = list()\n",
    "\t# calculate an RMSE score for each day\n",
    "\tfor i in range(actual.shape[1]):\n",
    "\t\t# calculate mse\n",
    "\t\tmse = mean_squared_error(actual[:, i], predicted[:, i])\n",
    "\t\t# calculate rmse\n",
    "\t\trmse = sqrt(mse)\n",
    "\t\t# store\n",
    "\t\tscores.append(rmse)\n",
    "\t# calculate overall RMSE\n",
    "\ts = 0\n",
    "\tfor row in range(actual.shape[0]):\n",
    "\t\tfor col in range(actual.shape[1]):\n",
    "\t\t\ts += (actual[row, col] - predicted[row, col])**2\n",
    "\tscore = sqrt(s / (actual.shape[0] * actual.shape[1]))\n",
    "\treturn score, scores\n",
    "\n",
    "# summarize scores\n",
    "def summarize_scores(name, score, scores):\n",
    "\ts_scores = ', '.join(['%.1f' % s for s in scores])\n",
    "\tprint('%s: [%.3f] %s' % (name, score, s_scores))\n",
    "\n",
    "# convert history into inputs and outputs\n",
    "def to_supervised(train, n_input, n_out=7):\n",
    "\t# flatten data\n",
    "\tdata = train.reshape((train.shape[0]*train.shape[1], train.shape[2]))\n",
    "\tX, y = list(), list()\n",
    "\tin_start = 0\n",
    "\t# step over the entire history one time step at a time\n",
    "\tfor _ in range(len(data)):\n",
    "\t\t# define the end of the input sequence\n",
    "\t\tin_end = in_start + n_input\n",
    "\t\tout_end = in_end + n_out\n",
    "\t\t# ensure we have enough data for this instance\n",
    "\t\tif out_end < len(data):\n",
    "\t\t\tX.append(data[in_start:in_end, :])\n",
    "\t\t\ty.append(data[in_end:out_end, 0])\n",
    "\t\t# move along one time step\n",
    "\t\tin_start += 1\n",
    "\treturn array(X), array(y)\n",
    "\n",
    "# train the model\n",
    "def build_model(train, n_input):\n",
    "\t# prepare data\n",
    "\ttrain_x, train_y = to_supervised(train, n_input)\n",
    "\t# define parameters\n",
    "\tverbose, epochs, batch_size = 0, 50, 16\n",
    "\tn_timesteps, n_features, n_outputs = train_x.shape[1], train_x.shape[2], train_y.shape[1]\n",
    "\t# reshape output into [samples, timesteps, features]\n",
    "\ttrain_y = train_y.reshape((train_y.shape[0], train_y.shape[1], 1))\n",
    "\t# define model\n",
    "\tmodel = Sequential()\n",
    "\tmodel.add(LSTM(200, activation='relu', input_shape=(n_timesteps, n_features)))\n",
    "\tmodel.add(RepeatVector(n_outputs))\n",
    "\tmodel.add(LSTM(200, activation='relu', return_sequences=True))\n",
    "\tmodel.add(TimeDistributed(Dense(100, activation='relu')))\n",
    "\tmodel.add(TimeDistributed(Dense(1)))\n",
    "\tmodel.compile(loss='mse', optimizer='adam')\n",
    "\t# fit network\n",
    "\tmodel.fit(train_x, train_y, epochs=epochs, batch_size=batch_size, verbose=verbose)\n",
    "\treturn model\n",
    "\n",
    "# make a forecast\n",
    "def forecast(model, history, n_input):\n",
    "\t# flatten data\n",
    "\tdata = array(history)\n",
    "\tdata = data.reshape((data.shape[0]*data.shape[1], data.shape[2]))\n",
    "\t# retrieve last observations for input data\n",
    "\tinput_x = data[-n_input:, :]\n",
    "\t# reshape into [1, n_input, n]\n",
    "\tinput_x = input_x.reshape((1, input_x.shape[0], input_x.shape[1]))\n",
    "\t# forecast the next week\n",
    "\tyhat = model.predict(input_x, verbose=0)\n",
    "\t# we only want the vector forecast\n",
    "\tyhat = yhat[0]\n",
    "\treturn yhat\n",
    "\n",
    "# evaluate a single model\n",
    "def evaluate_model(train, test, n_input):\n",
    "\t# fit model\n",
    "\tmodel = build_model(train, n_input)\n",
    "\t# history is a list of weekly data\n",
    "\thistory = [x for x in train]\n",
    "\t# walk-forward validation over each week\n",
    "\tpredictions = list()\n",
    "\tfor i in range(len(test)):\n",
    "\t\t# predict the week\n",
    "\t\tyhat_sequence = forecast(model, history, n_input)\n",
    "\t\t# store the predictions\n",
    "\t\tpredictions.append(yhat_sequence)\n",
    "\t\t# get real observation and add to history for predicting the next week\n",
    "\t\thistory.append(test[i, :])\n",
    "\t# evaluate predictions days for each week\n",
    "\tpredictions = array(predictions)\n",
    "\tscore, scores = evaluate_forecasts(test[:, :, 0], predictions)\n",
    "\treturn score, scores\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "metadata": {},
   "outputs": [],
   "source": [
    "def split_test_train(data, split_ratio):\n",
    "    \"\"\"\n",
    "    This function splits the data into train and test sets based on the ratio provided. \n",
    "    \n",
    "    Parameters: \n",
    "        data (Pandas dataframe): This is the dataframe provided. \n",
    "        split_ratio (float): A number between 0 and 1. \n",
    "    \n",
    "    Returns:\n",
    "        Returns the two dataframes in the ratio \n",
    "        \n",
    "    \"\"\"\n",
    "    if not isinstance(split_ratio, float):\n",
    "        raise(TypeError, \"The type of split_ratio is not float\")\n",
    "\n",
    "    if (split_ratio < 0) or (split_ratio > 1):\n",
    "        raise(ValueError, \"The split_error value should be between 0 and 1\")\n",
    "\n",
    "    train_length = split_ratio * len(data)\n",
    "    # split into standard weeks\n",
    "    train, test = data[0:round(train_length), :, :], data[round(train_length):, :, :]\n",
    "\n",
    "    return train, test\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "metadata": {},
   "outputs": [],
   "source": [
    "# convert history into inputs and outputs\n",
    "def to_supervised(train, n_input, n_out=7):\n",
    "\t# flatten data\n",
    "\tdata = train.reshape((train.shape[0]*train.shape[1], train.shape[2]))\n",
    "\tX, y = list(), list()\n",
    "\tin_start = 0\n",
    "\t# step over the entire history one time step at a time\n",
    "\tfor _ in range(len(data)):\n",
    "\t\t# define the end of the input sequence\n",
    "\t\tin_end = in_start + n_input\n",
    "\t\tout_end = in_end + n_out\n",
    "\t\t# ensure we have enough data for this instance\n",
    "\t\tif out_end < len(data):\n",
    "\t\t\tX.append(data[in_start:in_end, :])\n",
    "\t\t\ty.append(data[in_end:out_end, 0])\n",
    "\t\t# move along one time step\n",
    "\t\tin_start += 1\n",
    "\treturn array(X), array(y)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "metadata": {},
   "outputs": [],
   "source": [
    "def series_to_supervised(data, n_in=1, n_out=1, out_vars=1, out_var_indices=[3], dropnan=True):\n",
    "\tn_vars = 1 if type(data) is list else data.shape[1]\n",
    "\t#print(n_vars)\n",
    "\tdf = pd.DataFrame(data)\n",
    "\tcols, names = list(), list()\n",
    "\t# input sequence (t-n, ... t-1)\n",
    "\tfor i in range(n_in, 0, -1):\n",
    "\t\tcols.append(df.shift(i))\n",
    "\t\tnames += [('var%d(t-%d)' % (j+1, i)) for j in range(n_vars)]    \n",
    "\t# forecast sequence (t, t+1, ... t+n)\n",
    "\tfor i in range(0, n_out):\n",
    "\t\tcols.append(df.iloc[:, out_var_indices].shift(-i))\n",
    "\t\tif i == 0:\n",
    "\t\t\tnames += [('var%d(t)' % (j+1)) for j in range(out_vars)]\n",
    "\t\telse:\n",
    "\t\t\tnames += [('var%d(t+%d)' % (j+1, i)) for j in range(out_vars)]\n",
    "\t# put it all together\n",
    "\tagg = pd.concat(cols, axis=1)\n",
    "\tagg.columns = names\n",
    "\t# drop rows with NaN values\n",
    "\tif dropnan:\n",
    "\t\tagg.dropna(inplace=True)\n",
    "\t# Get the values from the dataframe\n",
    "\tagg_values = agg.values\n",
    "\t# Reshape for LSTM friendly input\n",
    "\tagg_values_reshaped = agg_values.reshape(agg_values.shape[0], 1, agg_values.shape[1])\n",
    "\treturn agg_values_reshaped\n",
    " "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 176,
   "metadata": {},
   "outputs": [],
   "source": [
    "s_values = series_to_supervised(values)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 177,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[1.0000358e+01, 0.0000000e+00, 4.1906991e+00, 0.0000000e+00,\n",
       "         0.0000000e+00]],\n",
       "\n",
       "       [[2.0000433e+01, 0.0000000e+00, 4.1906991e+00, 0.0000000e+00,\n",
       "         0.0000000e+00]],\n",
       "\n",
       "       [[3.0016045e+01, 0.0000000e+00, 4.1908612e+00, 0.0000000e+00,\n",
       "         0.0000000e+00]],\n",
       "\n",
       "       [[4.0031506e+01, 0.0000000e+00, 4.1905375e+00, 0.0000000e+00,\n",
       "         0.0000000e+00]],\n",
       "\n",
       "       [[5.0047245e+01, 0.0000000e+00, 4.1908612e+00, 0.0000000e+00,\n",
       "         0.0000000e+00]],\n",
       "\n",
       "       [[6.0000206e+01, 0.0000000e+00, 4.1908612e+00, 0.0000000e+00,\n",
       "         4.0699399e-10]],\n",
       "\n",
       "       [[6.0000538e+01, 7.4950171e-01, 4.2476635e+00, 4.0699399e-10,\n",
       "         2.2920124e-04]],\n",
       "\n",
       "       [[7.0000839e+01, 7.5458199e-02, 4.1991143e+00, 2.2920124e-04,\n",
       "         4.2419974e-04]],\n",
       "\n",
       "       [[8.0000862e+01, 6.6018321e-02, 4.1991143e+00, 4.2419974e-04,\n",
       "         5.9909764e-04]],\n",
       "\n",
       "       [[9.0016304e+01, 6.0209163e-02, 4.1991143e+00, 5.9909764e-04,\n",
       "         7.5941172e-04]]], dtype=float32)"
      ]
     },
     "execution_count": 177,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s_values[0:10, :, :]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_s, test_s = split_test_train(s_values, 0.8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 179,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1427430, 1, 5)"
      ]
     },
     "execution_count": 179,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_s.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 277,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_size = 1000000\n",
    "test_size = 1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 278,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_s_X = train_s[0:train_size, :, :-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 279,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1000000, 1, 4)"
      ]
     },
     "execution_count": 279,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_s_X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 280,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_s_X = test_s[0:test_size, :, :-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 281,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1000, 1, 4)"
      ]
     },
     "execution_count": 281,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_s_X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 282,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_s_y = train_s[0:train_size, :, -1:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 283,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_s_y = test_s[0:test_size, :, -1:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 284,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1000, 1, 1)"
      ]
     },
     "execution_count": 284,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_s_y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 285,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1000000, 1, 1)"
      ]
     },
     "execution_count": 285,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_s_y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 286,
   "metadata": {},
   "outputs": [],
   "source": [
    "verbose, epochs, batch_size = 0, 30, 16\n",
    "n_timesteps, n_features, n_outputs = train_s_X.shape[1], train_s_X.shape[2], train_s_y.shape[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 287,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = Sequential()\n",
    "model.add(LSTM(200, activation='relu', input_shape=(n_timesteps, n_features)))\n",
    "model.add(RepeatVector(n_outputs))\n",
    "model.add(LSTM(200, activation='relu', return_sequences=True))\n",
    "model.add(TimeDistributed(Dense(100, activation='relu')))\n",
    "model.add(TimeDistributed(Dense(1)))\n",
    "model.compile(loss='mse', optimizer='adam')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 288,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x7f4d341889b0>"
      ]
     },
     "execution_count": 288,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# fit network\n",
    "model.fit(train_s_X, train_s_y, epochs=epochs, batch_size=batch_size, verbose=verbose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 289,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1000, 1, 4)"
      ]
     },
     "execution_count": 289,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_s_X.shape\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 290,
   "metadata": {},
   "outputs": [],
   "source": [
    "predictions = model.predict(test_s_X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 291,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1000, 1, 1)"
      ]
     },
     "execution_count": 291,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "predictions.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 292,
   "metadata": {},
   "outputs": [],
   "source": [
    "score, scores = evaluate_forecasts(test_s_y[:, :, 0], predictions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 293,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.26192150517868645"
      ]
     },
     "execution_count": 293,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 294,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0.26192150517868645]"
      ]
     },
     "execution_count": 294,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "scores"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 295,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f4cb423b160>]"
      ]
     },
     "execution_count": 295,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAHnpJREFUeJzt3WmQXOV97/Hvv/eefaQZDdJIYiRLGMQiljEG23HJYbHALsmp8k1QxWXjDVfKeOE6voWTG/sav0gckmsHGy9UvFy8wCW+SZAdjGwTQVzYIhqCkZGEQAghDdpGgzRrT6/PfdGnWz3DSNMz6lFPn/l9qrrOOU8/3f0/c6Tfc/r06T7mnENERPwlUO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8t3gpsMLP95K/L+4fk9+RbvAu+wPh18sMFYXqBXufcU97yT8iHvV+3McD1wMvOuT7nXBr4Z+At+Hs7l5rutq3YNq+1cC/nwiE1ycyM/O/i73bO/e+Su0ovhPIB8sfiC+3v9z51vwYYKLz9qwXOuc8555Y657rIb8d/d879KbCV/AVf4PXrW9MXhHHOHQEOmtkbvabrgF34dBt7DgDXmFmd92+8sM6+3c4TTHfbbgFuNLNW713PjV7b9FX7A4gZfGBxM/AC8BLwl9Wup4Lr9Tbyb792AL/zbjeTP974GPCiN13g9TfyZw69BPye/NkIVV+PGa77OuBn3vxK4D+BvcA/AVGvPeYt7/XuX1ntume4rpcDPd52/leg1e/bGPgi8DzwHPADIOrH7Qw8QP5zhTT5PfAPz2TbAh/y1n8v8MGZ1qNvqIqI+FCtHZYREZEyKNxFRHxI4S4i4kMKdxERH1K4i4j4kMJdRMSHFO4iIj6kcBcR8aH/D+F31fMbYzr6AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(test_s_y[:,0,0])\n",
    "plt.plot(predictions[:,0,0])\n",
    "plt.plot(test_s_X[:, 0, 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python (keras2)",
   "language": "python",
   "name": "keras2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
